﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ENTITY;
using BUS;
using System.Data;

public partial class Admin_AddChiTietMonOc : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        EntChiTietMonoc entity = new EntChiTietMonoc();
        entity.Tenchebien = ddl_chebien.SelectedItem.Text;
        entity.Soluongnhap = decimal.Parse(tbx_soluongnhap.Text.ToString().Trim());
        entity.Soluongton = decimal.Parse(tbx_soluongton.Text.ToString().Trim());
        entity.Ngaynhap = lich_ngaynhap.SelectedDate;
        entity.Image = "../Images/Oc_file/image001.jpg";
        entity.Tinhtrang = ddl_tinhtrang.SelectedItem.Text;
        entity.Giatien = int.Parse(tbx_giatien.Text.ToString().Trim());

        ABusShow show = new ABusShow();
        DataTable dt = show.ShowAllMonOc();
        int i = dt.Rows.Count;
        i--;
        entity.Machitietmo = int.Parse(dt.Rows[i].ItemArray[0].ToString().Trim());
        ABusAdd add = new ABusAdd();
        add.AddChiTietMonOc(entity);
    }
}
